package com.djbx.points.common.core.utils;

/**
 * 公共应答码枚举
 */
public enum ResponseCode {

    FAILED(0, "失败"),
    SUCCESS(1, "成功"),
    SERVER_ERROR(8000, "服务异常"),
    NO_HANDLER_ERROR(8001, "请求路径错误"),
    REQUEST_NOT_SUPPORTED_ERROR(8002, "请求无法匹配"),
    MEDIA_TYPE_NOT_SUPPORTED_ERROR(8003, "请求资源类型错误"),
    MISSING_PATH_VARIABLE_ERROR(8004, "未检测到路径参数"),
    MISSING_REQUEST_PARAM_ERROR(8005, "缺少请求参数"),
    HTTP_MESSAGE_NOT_READABLE_ERROR(8007, "无法读取请求信息"),
    HTTP_MESSAGE_NOT_WRITABLE_ERROR(8008, "POJO序列化失败"),
    MEDIA_TYPE_NOT_ACCEPTABLE_ERROR(8010, "接收资源类型错误"),
    REQUEST_BINDING_ERROR(8011, "数据绑定错误"),
    TYPE_MISMATCH_ERROR(8012, "参数类型匹配失败"),
    PARAMETER_VALID_ERROR(8013, "参数校验异常: "),
    ASYNC_REQUEST_TIMEOUT_ERROR(8014, "异步请求超时"),
    MISSING_REQUEST_PART_ERROR(8015, "上传文件失败"),

    WAIT_OPERATION_ERROR(8016, "等待超时"),
    REPEAT_OPERATION_ERROR(8017, "重复操作"),

    SERVICE_FALLBACK(9001, "服务降级"),
    SERVICE_TIMEOUT(9002, "服务超时");

    private int code;
    private String message;

    ResponseCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    void setMessage(String message) {
        this.message = message;
    }
}
